import hashlib


def wechat_check_sign(notify_data, merchant_key):
    params = [(k, v) for k, v in notify_data.items() if k != 'sign']
    params.sort(key=lambda x: x[0])
    stringA = '&'.join([f"{k}={v}" for k, v in params])
    stringSignTemp = f"{stringA}&key={merchant_key}"
    sign = hashlib.md5(stringSignTemp.encode()).hexdigest().upper()
    return sign == notify_data.get('sign', '')
